package com.example.wendao.model.db.database;


import androidx.room.Database;
import androidx.room.Room;
import androidx.room.RoomDatabase;

import com.example.wendao.App;
import com.example.wendao.model.db.dao.FansDao;
import com.example.wendao.model.db.dao.ForumDao;
import com.example.wendao.model.db.dao.ForumPicsDao;
import com.example.wendao.model.db.dao.ForumTagDao;
import com.example.wendao.model.db.dao.GoodsDao;
import com.example.wendao.model.db.dao.NewsCommentDao;
import com.example.wendao.model.db.dao.NewsDao;
import com.example.wendao.model.db.dao.NewsPicsDao;
import com.example.wendao.model.db.dao.UserDao;
import com.example.wendao.model.entity.Fans;
import com.example.wendao.model.entity.Forum;
import com.example.wendao.model.entity.ForumPics;
import com.example.wendao.model.entity.ForumTag;
import com.example.wendao.model.entity.Goods;
import com.example.wendao.model.entity.News;
import com.example.wendao.model.entity.NewsComment;
import com.example.wendao.model.entity.NewsPics;
import com.example.wendao.model.entity.User;

@Database(entities = {User.class, NewsComment.class, ForumPics.class, Forum.class,
        Fans.class, Goods.class, News.class, NewsPics.class, ForumTag.class
}, version = 1, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {

    private static volatile AppDatabase db = null;

    public static synchronized AppDatabase getDatabases() {
        return db = db == null ? Room.databaseBuilder(App.getContext(), AppDatabase.class, App.DATABASE_NAME).build() : db;
    }

    public abstract UserDao getUserDao();
    public abstract ForumDao getForumDao();
    public abstract ForumPicsDao getForumPicsDao();
    public abstract NewsCommentDao getNewsCommentDao();
    public abstract FansDao getFansDao();
    public abstract GoodsDao getGoodsDao();
    public abstract NewsDao getNewsDao();
    public abstract NewsPicsDao getNewsPicsDao();
    public abstract ForumTagDao getForumTagDao();

}

